using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;



namespace BUS
{
    class tbChuDeBus
    {
        public static void Insert_ChuDe(tbChuDe chude)
        {
            tbChuDeDAL ChuDeDAL = new tbChuDeDAL();
            ChuDeDAL.Insert(chude);
        }
        public static void Update_ChuDe(tbChuDe chude)
        {
            tbChuDeDAL ChuDeDAL = new tbChuDeDAL();
            ChuDeDAL.Update(chude);
        }
        public static void Delete_Chude(int Id)
        {
            tbChuDeDAL ChuDeDAL=new tbChuDeDAL();
            ChuDeDAL .Delete (Id);
        }
        public static tbChuDe.tbChuDeCollection Get(string Where, int PageIndex, int PageSize, string OderBy, string OderDirection, out int Total)
        {
            tbChuDeDAL ChuDe_Get = new tbChuDeDAL();
            return(ChuDe_Get.Get(Where, PageIndex, PageSize, OderBy, OderDirection, out Total));
        }
        public static tbChuDe.tbChuDeCollection GetAll()
        {
            int Total = 0;
            tbChuDeDAL Chude_GetAll = new tbChuDeDAL();
            return (Chude_GetAll .Get ("Where 1=1",0,0,tbChuDe .tbChuDeColumns .MaCD.ToString () ,"ASC",out Total ));
        }
        public static tbChuDe GetId(int Id)
        {
            int Total = 0;
            tbChuDeDAL ChuDe_GetId = new tbChuDeDAL();
            tbChuDe .tbChuDeCollection ChuDeColection=ChuDe_GetId .Get ("Where " +tbChuDe .tbChuDeColumns .MaCD +"= "+ Id.ToString (),0,0,tbChuDe .tbChuDeColumns .MaCD .ToString (),"ASC",out Total );
            if (ChuDeColection.Count > 0)
                return ChuDeColection[0];
            return null;
        }
    }
}
